<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>修改密码</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
		<link rel="stylesheet" href="__INDEX__/css/iconfont.css">
		<link rel="stylesheet" href="__INDEX__/css/yund.css">
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
			<h1 class="mui-title">修改密码</h1>
		</header>
		<div class="mui-content" style="background: none;">
			<div class="gerenzl_nr">
				<form id="my_form" class="layui-form update_form" action="" method="post">
					<div class="mui-input-row ">
						<label>旧密码</label>
						<input type="text" id="jpassword" name="jpassword" class="layui-input" placeholder="请输入旧密码">
					</div>
					<div class="mui-input-row">
						<label>新密码</label>
						<input type="text" id="xpassword" name="xpassword" class="layui-input" placeholder="请输入新密码码">
					</div>
				</form>				
			</div>
			<button  id='change_but' class="layui-btn tixian_btn" lay-submit lay-filter="demo1">确认</button>
		</div>

	</body>

</html>
<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
<script type="text/javascript" src="__PUBLIC__/static/layui/layui.all.js"></script>
<script>
	layui.use(['form'], function(){
		var $ = layui.jquery,form = layui.form;
	  	//监听提交
		form.on('submit(demo1)', function(data){
			$('#change_but').addClass("layui-btn-disabled");
			set_content();
			return false;
		});
	})
	
	function set_content(){
		var jpassword = $("#jpassword").val();
		var xpassword = $("#xpassword").val();
		if(jpassword.trim() == '') {
			layer.msg('旧密码不能为空');
			return;
		}
		if(xpassword.trim() == '') {
			layer.msg('新密码不能为空');
			return;
		}
		$.ajax({
			type:"post",
			url: "{:url('index/member/edit_password')}",
			data: {
				jpassword: jpassword,
				xpassword: xpassword,
			},
			success: function(data) {
				layer.msg(data.msg, {
				  icon: 1,
				  time: 1500 //2秒关闭（如果不配置，默认是3秒）
				}, function(){
					  if(data.code == 200) {
							location.href = data.url
					  }
				}); 
			}
		})
	}
	
</script>